import java.util.*;

public class Deck
{
	public Stack<Card> stack;
	public Stack<Card> deck;
	public Deck()
	{
		stack = new Stack<Card>();
		deck = new Stack<Card>();
        for (Suit suit : Suit.values())
		{
            for (Value value : Value.values()) 
             {
				stack.push(new Card(value, suit));
			 }
		}
		
		Random randGenerator = new Random();
		int rand = randGenerator.nextInt(52);
		Card[] tempDeck = new Card[52];
		try{
		for (int i=0; i<52; i++)
		{
			tempDeck[i] = stack.pop();
		}}
		catch(EmptyStackException e)
		{}
	
		Card tempCard;
		for (int i=0; i<52 ; i++)
		{
			tempCard = tempDeck[i];
			tempDeck[i] = tempDeck[rand];
			tempDeck[rand] = tempCard;
			rand = randGenerator.nextInt(52);
		}
		
		for (int i=0; i<52; i++)
		{
			deck.push(tempDeck[i]);
		}
		
	
	}

	public Card getNewCard()
	{
		return deck.pop();
	}


}